package operation;

import book.BookList;

import java.util.Scanner;

public class back implements IOperation{

    @Override
    public void work(BookList Booklist) {
        Scanner scanner = new Scanner(System.in);
        find findbyname = new find();
        System.out.print("请输入需要归还书籍的书名：");
        int findnmber = findbyname.find_name(Booklist, scanner.next());
        if(findnmber<0) {
            System.out.println("未找到该书籍的信息，归还失败！！！");
        } else{
            if(Booklist.getBooklist()[findnmber].isStatestate()) {
                System.out.println("该书籍未被借出，归还失败！！！");
            } else {
                Booklist.getBooklist()[findnmber].setStatestate(true);
                System.out.println("书籍归还成功！！！");
            }
        }
    }
}